<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>props传递数据</title>
    </head>
    <body>

        <div id = "app">
            <input type="text" v-model="parentMessage">
            <my-component :message="parentMessage"></my-component>
        </div>
        <script src="../../vue.min.js"></script>
        <script>
            Vue.component('my-component', {
                props: ['message'],
                // template: '<div>{{ message }}</div><button @click="changeMessage"></button>',
                template: '<div>{{ message }}<button @click="changeMessage" >点击修改父数据</button></div>',
                methods:{
                    changeMessage:function () {
                        this.message=1;
                    }
                }
            });
            var app = new Vue({
                el: '#app',
                data: {
                    parentMessage: ''
                }
            })
        </script>
    </body>
</html>